/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.mallsite.modules.shop.entity;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 商品属性Entity
 * @author ruyang
 * @version 2020-12-04
 */
@Table(name="ms_goods_attr", alias="a", columns={
		@Column(name="attr_id", attrName="attrId", label="类型编码", isPK=true),
		@Column(name="attr_name", attrName="attrName", label="属性名称", queryType=QueryType.LIKE),
		@Column(name="type_id", attrName="typeId", label="属性分类id", comment="属性分类id(商品类型id)"),
		@Column(name="attr_type", attrName="attrType", label="0唯一属性 1单选属性 2复选属性"),
		@Column(name="attr_values", attrName="attrValues", label="可选值列表"),
		@Column(name="attr_sort", attrName="attrSort", label="attr_sort"),
		@Column(name="shop_id", attrName="shopId"),
		@Column(includeEntity=DataEntity.class),
	},joinTable={
			@JoinTable(type=Type.LEFT_JOIN, entity=Shop.class, alias="b",
					on="b.shop_id = a.shop_id",
					columns={
							@Column(name="shop_id", label="商户编码", isPK=true),
							@Column(name="shop_name", label="商户名称", isQuery=false),
				}),
			}, orderBy="a.update_date DESC"
)
public class GoodsAttr extends DataEntity<GoodsAttr> {
	
	private static final long serialVersionUID = 1L;
	private String attrId;		// 类型编码
	private String attrName;		// 属性名称
	private String typeId;		// 属性分类id(商品类型id)
	private String attrType;		// 0唯一属性 1单选属性 2复选属性
	private String attrValues;		// 可选值列表
	private Integer attrSort;		// attr_sort
	private String shopId;
	
	private Shop shop;
	
	public GoodsAttr() {
		this(null);
	}

	public GoodsAttr(String id){
		super(id);
	}
	
	public String getAttrId() {
		return attrId;
	}

	public void setAttrId(String attrId) {
		this.attrId = attrId;
	}
	
	@NotBlank(message="属性名称不能为空")
	public String getAttrName() {
		return attrName;
	}

	public void setAttrName(String attrName) {
		this.attrName = attrName;
	}
	
	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}
	
	public String getAttrType() {
		return attrType;
	}

	public void setAttrType(String attrType) {
		this.attrType = attrType;
	}
	
	public String getAttrValues() {
		return attrValues;
	}

	public void setAttrValues(String attrValues) {
		this.attrValues = attrValues;
	}
	
	public Integer getAttrSort() {
		return attrSort;
	}

	public void setAttrSort(Integer attrSort) {
		this.attrSort = attrSort;
	}

	public String getShopId() {
		return shopId;
	}

	public void setShopId(String shopId) {
		this.shopId = shopId;
	}

	public Shop getShop() {
		return shop;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}
	
	
}